home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1998 April: Mac OS SDK / Dev.CD Apr 98 SDK1.toast / Development Kits (Disc 1) / Installer SDK Cornucopia 1.1.2 / Upgrader / Released / Upgrader 1.1.1 / Additional Plug-in Examples / Preflight Function Example / PreflightFunctionExample.c < prev    next >
Encoding:
C/C++ Source or Header  |  1998-02-12  |  3.3 KB  |  80 lines  |  [TEXT/CWIE]

  1. /*
  2.     File:        ExamplePreflightExtension.c
  3.  
  4.     Note:         InstallMod extensions are called by the InstallMod plug-in while it is initializing 
  5.                 itself. If there is some reason to check whether a installer script under special
  6.                 circumstances should
  7.                     • Not be displayed in the Easy Install list
  8.                     • Not be displayed in the Custom Install list
  9.                     • Should have the software installer checkbox set to either checked or unchecked
  10.                       in the InstallModList.
  11.                 then writing an extension may be the best solution.
  12.                 
  13.                 For example there may be a case where some of the software to be installed is specific
  14.                 to powerbooks and you may want this installer hidden from the list if installing on desktop
  15.                 machines. 
  16.                 
  17.  
  18.     Contains:    A extension to the Upgrader 1.1 InstallMod plug-in which checks if the current machine 
  19.                 is the same as the one referenced by inSoftwareInstallerPreflightPBRec->fRefCon. If the 
  20.                 machine is the same then the Installer script that this extension relates to won't be 
  21.                 shown in the InstallMod installation easy list.
  22.                 
  23.                 To see this the results of this extension, first compile the code resource, then add the 
  24.                 resource to the ClientData (Upgrader 1.1 script) file. Then for each Installer script you'd
  25.                 like to see removed from the list on the machine selected by fRefCon, add the extension code
  26.                 resource details to the the preflight section of the software item list 'ippr' resource. 
  27.                 
  28.                 These details are the type of code resource 'pffn', the id of the code resource and in the preflight
  29.                 refCon the machine id for which you want to hide an installer script. 
  30.                 
  31.                 
  32.  
  33.     Version:    1.1
  34.  
  35.     Copyright:    © 1997 by Apple Computer, Inc., all rights reserved.
  36.         
  37. */
  38.  
  39.  #include <Gestalt.h>
  40.  
  41.  #include "InstallationPluginExt.h"
  42.  
  43.  // Prototype for main entry point to extension code resource
  44.  SoftwareInstallerPreflightResult main ( SoftwareInstallerPreflightPBRec *inSoftwareInstallerPreflightPBRec );
  45.  
  46.  SoftwareInstallerPreflightResult main ( SoftwareInstallerPreflightPBRec *inSoftwareInstallerPreflightPBRec )
  47.  {
  48.      SoftwareInstallerPreflightResult     theErr = kNoError;
  49.      long                                machineType;
  50.      
  51.      //SysBeep(10);                                                                        
  52.      
  53.      if ( inSoftwareInstallerPreflightPBRec != (SoftwareInstallerPreflightPBRec*)NULL )
  54.      {
  55.          theErr = Gestalt( gestaltMachineType, &machineType );
  56.          if ( theErr == kNoError )
  57.          {
  58.              if ( machineType == inSoftwareInstallerPreflightPBRec->fRefCon )            // fRefCon contains a machine ID, it could also be used to contain
  59.                                                                                          // a Resource ID of a resource containing a list of machines if 
  60.                                                                                          // this was necessary
  61.              {
  62.                  inSoftwareInstallerPreflightPBRec->fSkipOnEasy = true;                    // we want the installer script removed from the easy install
  63.                  inSoftwareInstallerPreflightPBRec->fSkipOnCustom = false;                // but left in the custom install
  64.                  inSoftwareInstallerPreflightPBRec->fOverrideDefaultSelection = false;    // don't need to do this for this example
  65.                  inSoftwareInstallerPreflightPBRec->fSelectIfOverridden = false;            // this value is only used if fOverrideDefaultSelection is true
  66.              }
  67.          }
  68.          else
  69.          {
  70.              theErr = kInternalError;
  71.          }
  72.      }
  73.      else
  74.      {
  75.          theErr = kInternalError;                                        
  76.      }    
  77.      
  78.      return theErr;                        // if an error is returned a alert dialog will be displayed stating than an internal error occured in 
  79.  }                                        // a preflight extension.
  80.